
#include "GraphicFactoryD3D.h"

namespace D3Ds
{
	GraphicFactoryD3D::GraphicFactoryD3D(Window& win)
		:m_GraphicD3D(0)
	{
		m_GraphicD3D = new GraphicD3D(win);
	}

	GraphicFactoryD3D::~GraphicFactoryD3D(void)
	{
		if(m_GraphicD3D != 0)
		{
			delete m_GraphicD3D;
		}
	}

	
	Drawable* GraphicFactoryD3D::CreateDrawable(int width, int height)
	{
		Drawable* dd = 0;
		try
		{
			dd = new D3Ds::DrawableD3D(*m_GraphicD3D,width,height);
		}	
		catch(...)
		{
			return 0;
		}
		return dd;
	}
	
	Drawable* GraphicFactoryD3D::CreateDrawable(const std::string& filename,DWORD colorKey)
	{
		Drawable* dd = 0;
		try
		{			
			dd = new D3Ds::DrawableD3D(*m_GraphicD3D,filename,colorKey);
		
		}
		catch(...)
		{
			return 0;
		}
		return dd;
	}
	Graphics::Graphic2D * const GraphicFactoryD3D:: GetGraphic2D()
	{
		return m_GraphicD3D;
	}
}